package cc.eddic.pratice.programmingparadigms;

import cc.eddic.pratice.programmingparadigms.advanced.BeanFactory;
import cc.eddic.pratice.programmingparadigms.exam.QuestionBankService;
import cc.eddic.pratice.programmingparadigms.exam.impl.QuestionBankServiceCxyImpl;
import cc.eddic.pratice.programmingparadigms.exam.impl.QuestionBankServiceGcsImpl;
import cc.eddic.pratice.programmingparadigms.exam.impl.QuestionBankServiceTyqImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Slf4j
@Controller
@RequestMapping("/questions")
public class QuestionController {
    @RequestMapping()
    public String list(Model model) {

        QuestionBankService bankService = BeanFactory.getBean(QuestionBankService.class, "Gcs");

//        model.addAttribute("questionList",
//                bankService.importCategories("C:\\Users\\zyz\\Desktop\\category-answers.xlsx"));

        model.addAttribute("questionList", bankService.importQuestions(""));

        return "question-list";
    }
}
